/*
 ***************************************************************************
 * Ralink Tech Inc.
 * 4F, No. 2 Technology 5th Rd.
 * Science-based Industrial Park
 * Hsin-chu, Taiwan, R.O.C.
 *
 * (c) Copyright 2002-2004, Ralink Technology, Inc.
 *
 * All rights reserved. Ralink's source code is an unpublished work and the
 * use of a copyright notice does not imply otherwise. This source code
 * contains confidential trade secret material of Ralink Tech. Any attemp
 * or participation in deciphering, decoding, reverse engineering or in any
 * way altering the source code is stricitly prohibited, unless the prior
 * written consent of Ralink Technology, Inc. is obtained.
 ***************************************************************************

	Module Name:
	rt2880.c

	Abstract:
	Specific funcitons and variables for RT2880

	Revision History:
	Who         When          What
	--------    ----------    ----------------------------------------------
*/


#include	"rt_config.h"

#ifdef RT2880

/* Reset the RFIC setting to new series    */
RTMP_RF_REGS RF2850RegTable[] = {
/*		ch	 R1 		 R2 		 R3(TX0~4=0) R4*/
		{1,  0x98402ecc, 0x984c0786, 0x981ab455, 0x9800510b},
		{2,  0x98402ecc, 0x984c0786, 0x981a8a55, 0x9800519f},
		{3,  0x98402ecc, 0x984c078a, 0x981a8a55, 0x9800518b},
		{4,  0x98402ecc, 0x984c078a, 0x981a8a55, 0x9800519f},
		{5,  0x98402ecc, 0x984c078e, 0x981a8a55, 0x9800518b},
		{6,  0x98402ecc, 0x984c078e, 0x981a8a55, 0x9800519f},
		{7,  0x98402ecc, 0x984c0792, 0x981a8a55, 0x9800518b},
		{8,  0x98402ecc, 0x984c0792, 0x981a8a55, 0x9800519f},
		{9,  0x98402ecc, 0x984c0796, 0x981a8a55, 0x9800518b},
		{10, 0x98402ecc, 0x984c0796, 0x981a8a55, 0x9800519f},
		{11, 0x98402ecc, 0x984c079a, 0x981a8a55, 0x9800518b},
		{12, 0x98402ecc, 0x984c079a, 0x981a8a55, 0x9800519f},
		{13, 0x98402ecc, 0x984c079e, 0x981a8a55, 0x9800518b},
		{14, 0x98402ecc, 0x984c07a2, 0x981a8a55, 0x98005193},

		/* 802.11 UNI / HyperLan 2*/
		{36, 0x98402ecc, 0x984c099a, 0x98198a55, 0x980ed1a3},
		{38, 0x98402ecc, 0x984c099e, 0x98198a55, 0x980ed193},
		{40, 0x98402ec8, 0x984c0682, 0x98198a55, 0x980ed183},
		{44, 0x98402ec8, 0x984c0682, 0x98198a55, 0x980ed1a3},
		{46, 0x98402ec8, 0x984c0686, 0x98198a55, 0x980ed18b},
		{48, 0x98402ec8, 0x984c0686, 0x98198a55, 0x980ed19b},
		{52, 0x98402ec8, 0x984c068a, 0x98198a55, 0x980ed193},
		{54, 0x98402ec8, 0x984c068a, 0x98198a55, 0x980ed1a3},
		{56, 0x98402ec8, 0x984c068e, 0x98198a55, 0x980ed18b},
		{60, 0x98402ec8, 0x984c0692, 0x98198a55, 0x980ed183},
		{62, 0x98402ec8, 0x984c0692, 0x98198a55, 0x980ed193},
		{64, 0x98402ec8, 0x984c0692, 0x98198a55, 0x980ed1a3}, /* Plugfest#4, Day4, change RFR3 left4th 9->5.*/

		/* 802.11 HyperLan 2*/
		{100, 0x98402ec8, 0x984c06b2, 0x981b8a55, 0x980ed783},
		
		/* 2008.04.30 modified */
		/* The system team has AN to improve the EVM value */
		/* for channel 102 to 108 for the RT2850/RT2750 dual band solution.*/
		{102, 0x98402ec8, 0x985c06b2, 0x985b8a55, 0x980ed793},
		{104, 0x98402ec8, 0x985c06b2, 0x985b8a55, 0x980ed1a3},
		{108, 0x98402ecc, 0x985c0a32, 0x985b8a55, 0x980ed193},

		{110, 0x98402ecc, 0x984c0a36, 0x981b8a55, 0x980ed183},
		{112, 0x98402ecc, 0x984c0a36, 0x981b8a55, 0x980ed19b},
		{116, 0x98402ecc, 0x984c0a3a, 0x981b8a55, 0x980ed1a3},
		{118, 0x98402ecc, 0x984c0a3e, 0x981b8a55, 0x980ed193},
		{120, 0x98402ec4, 0x984c0382, 0x981b8a55, 0x980ed183},
		{124, 0x98402ec4, 0x984c0382, 0x981b8a55, 0x980ed193},
		{126, 0x98402ec4, 0x984c0382, 0x981b8a55, 0x980ed15b}, /* 0x980ed1bb->0x980ed15b required by Rory 20070927*/
		{128, 0x98402ec4, 0x984c0382, 0x981b8a55, 0x980ed1a3},
		{132, 0x98402ec4, 0x984c0386, 0x981b8a55, 0x980ed18b},
		{134, 0x98402ec4, 0x984c0386, 0x981b8a55, 0x980ed193},
		{136, 0x98402ec4, 0x984c0386, 0x981b8a55, 0x980ed19b},
		{140, 0x98402ec4, 0x984c038a, 0x981b8a55, 0x980ed183},

		/* 802.11 UNII*/
		{149, 0x98402ec4, 0x984c038a, 0x981b8a55, 0x980ed1a7},
		{151, 0x98402ec4, 0x984c038e, 0x981b8a55, 0x980ed187},
		{153, 0x98402ec4, 0x984c038e, 0x981b8a55, 0x980ed18f},
		{157, 0x98402ec4, 0x984c038e, 0x981b8a55, 0x980ed19f},
		{159, 0x98402ec4, 0x984c038e, 0x981b8a55, 0x980ed1a7},
		{161, 0x98402ec4, 0x984c0392, 0x981b8a55, 0x980ed187},
		{165, 0x98402ec4, 0x984c0392, 0x981b8a55, 0x980ed197},
		{167, 0x98402ec4, 0x984c03d2, 0x981b9855, 0x9815531f},
		{169, 0x98402ec4, 0x984c03d2, 0x981b9855, 0x98155327},
		{171, 0x98402ec4, 0x984c03d6, 0x981b9855, 0x98155307},
		{173, 0x98402ec4, 0x984c03d6, 0x981b9855, 0x9815530f},

		/* Japan*/
		{184, 0x95002ccc, 0x9500491e, 0x9509be55, 0x950c0a0b},
		{188, 0x95002ccc, 0x95004922, 0x9509be55, 0x950c0a13},
		{192, 0x95002ccc, 0x95004926, 0x9509be55, 0x950c0a1b},
		{196, 0x95002ccc, 0x9500492a, 0x9509be55, 0x950c0a23},
		{208, 0x95002ccc, 0x9500493a, 0x9509be55, 0x950c0a13},
		{212, 0x95002ccc, 0x9500493e, 0x9509be55, 0x950c0a1b},
		{216, 0x95002ccc, 0x95004982, 0x9509be55, 0x950c0a23},

		/* still lack of MMAC(Japan) ch 34,38,42,46*/
};
UCHAR	NUM_OF_2850_CHNL = (sizeof(RF2850RegTable) / sizeof(RTMP_RF_REGS));


/* Default EEPROM value for RT2880 */
UCHAR RT2880_EeBuffer[EEPROM_SIZE] = {
	0x80,0x28,0x03,0x01,0x00,0x0C,0x43,0x28,0x60,0x20,0x01,0x08,0x14,0x18,0x01,0x80,
	0x00,0x00,0x80,0x28,0x14,0x18,0x00,0x00,0x01,0x00,0x6A,0xFF,0x0C,0x00,0xFF,0xFF,
	0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
	0xFF,0xFF,0xFF,0xFF,0x23,0x02,0x2C,0x00,0xFF,0xFF,0x1D,0x00,0xFF,0xFF,0xFF,0xFF,
	0xFF,0xFF,0xFF,0xFF,0x0A,0x10,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x08,0xFF,0xFF,
	0xFF,0xFF,0x0F,0x0F,0x0F,0x0F,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,
	0x13,0x13,0x12,0x12,0x11,0x11,0x10,0x10,0x10,0x10,0x0F,0x0F,0x0F,0x0F,0xFF,0xFF,
	0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,

	0x06,0x06,0x06,0x06,0x04,0x04,0x04,0x04,0x04,0x04,0x05,0x05,0x05,0x05,0x05,0x05,
	0x05,0x05,0x06,0x06,0x06,0x07,0x07,0x07,0x08,0x08,0x08,0xFF,0xFF,0xFF,0xFF,0xFF,
	0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x05,0x05,0x05,0x05,0x05,0x05,0x06,0x06,0x06,0x04,
	0x05,0x05,0x05,0x05,0x05,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,
	0x06,0x06,0x06,0x06,0x07,0x07,0x08,0x09,0x09,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
	0xFF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